<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../../js/jquery-1.11.3.js"></script>
</head>
<body>
<h1>saadsdsa</h1>
<div id="msg"></div>
<form method="get" action="http://localhost/ajax/b.php">
    <input type="text" name="username" id="username">
    <input type="button" id="btn" value="提交">
</form>
<script>
    $("#btn").click(function(){
        var url = 'http://localhost/ajax/b.php';
//        var url = 'b.html';
        $.ajax(url,{
            data:{
                username:$('#username').val()
            },
            success:function(data){
                console.log(data);
            }
        })
    })
</script>
</body>
</html>